﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;

namespace Growatt.WaveData.DataSetResolve
{
    public class ModelSaveString : INotifyPropertyChanged
    {
        private string name;
        private string type;
        private string scale;
        private string address;
        private string signalOffset;
        private bool isSelected;

        public string Name
        {
            get => name;
            set
            {
                if (name != value)
                {
                    name = value;
                    OnPropertyChanged(nameof(Name));
                }
            }
        }

        public string Type
        {
            get => type;
            set
            {
                if (type != value)
                {
                    type = value;
                    OnPropertyChanged(nameof(Type));
                }
            }
        }

        public string Scale
        {
            get => scale;
            set
            {
                if (scale != value)
                {
                    scale = value;
                    OnPropertyChanged(nameof(Scale));
                }
            }
        }

        public string Address
        {
            get => address;
            set
            {
                if (address != value)
                {
                    address = value;
                    OnPropertyChanged(nameof(Address));
                }
            }
        }

        public string SignalOffset
        {
            get => signalOffset;
            set
            {
                if (signalOffset != value)
                {
                    signalOffset = value;
                    OnPropertyChanged(nameof(SignalOffset));
                }
            }
        }

        public bool IsSelected
        {
            get => isSelected;
            set
            {
                if (isSelected != value)
                {
                    isSelected = value;
                    OnPropertyChanged(nameof(IsSelected));
                }
            }
        }

        // 实现 INotifyPropertyChanged 接口
        public event PropertyChangedEventHandler PropertyChanged;

        public virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class ModelSaveChanelCount
    {
        public int ChanelCount { get; set; } = 7;
    }

    public class ModelSaveChaneltempLoad
    {
        public List<ModelSaveString> ListModelSaveString { get; set; } = new List<ModelSaveString>();
    }

    public class AppSettingsCustom
    {
        public string BaudRate { get; set; } = "115200";
        public string PortName { get; set; } = "";
        public string SampleRate { get; set; } = "1000";
        public string OutPathHistory { get; set; } = "";
        public string TimeSetting { get; set; } = "";
        public string ScrollMode { get; set; } = "滚动模式";
        public string WriteValueName { get; set; } = "";
        public string WriteValue { get; set; } = "";
        public string RightLeft { get; set; } = "";
        public string UpDown { get; set; } = "";
        public string ChannalCount { get; set; } = "4";
        public FormWindowState ModeWindow { get; set; } = FormWindowState.Normal;
    }
}
